package com.knight.hadoop.day04.bigdata.proxy;

import java.lang.reflect.Proxy;

public class ProxyBoss {

	@SuppressWarnings("unchecked")
	public static <T> T getProxy(int discount, Class<?> interfaceClass, Class<?> implementsClass) {
		return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class<?>[] { interfaceClass },new MyHandler2(implementsClass,discount));
	}

	public static <T> T getProxy2(Class<?> interfaceClass) {
		return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass },
				new MyHandler());
	}
}
